/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI.Admin;

import java.util.List;
import javax.swing.table.DefaultTableModel;
import dao.*;
import java.util.Vector;
import pojo.*;
/**
 *
 * @author Dang Nhung
 */
public class Admin_SeatManage extends javax.swing.JPanel {

    private DefaultTableModel model1 = null;
    List<Chongoi> choNgois = null;
    private String arr_trash[] = {"Trống ","Đã đặt"};
    private String arr_type[] = {"Thường","Đặc biệt"};
    /**
     * Creates new form Admine_SeatManage
     */
    public Admin_SeatManage() {
        initComponents();
        LoadDBJTable();
    }

    final public void LoadDBJTable(){
        model1 = (DefaultTableModel) jtblistofseat.getModel();
        model1.getDataVector().clear();
        try{
            choNgois = ChoNgoiDAO.getChoNgois();
            int count = 0;
            for(Chongoi chongoi : choNgois){
                Vector v =new Vector();
                count = count + 1;
                v.addElement(count);
                v.addElement(chongoi.getCodeChoNgoi());
                v.addElement(chongoi.getViTriChoNgoi());
                v.addElement(chongoi.getViTriHangGhe());
                v.addElement(arr_type[chongoi.getLoaiCho()]);
                v.addElement(arr_trash[chongoi.getTrangThai()]);
                model1.addRow(v);
            }
            jtblistofseat.setModel(model1);
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jlbselectroom = new javax.swing.JLabel();
        jcbselectroom = new javax.swing.JComboBox();
        jPanel3 = new javax.swing.JPanel();
        jlbcodeid = new javax.swing.JLabel();
        jtxtcodeid = new javax.swing.JTextField();
        jcbroomname = new javax.swing.JComboBox();
        jlbroomname = new javax.swing.JLabel();
        jlblocationofseat = new javax.swing.JLabel();
        jtxtlocationofseat = new javax.swing.JTextField();
        jtxtlocationofseatline = new javax.swing.JTextField();
        jlblocationofseatline = new javax.swing.JLabel();
        jlbpriceofseat = new javax.swing.JLabel();
        jtxtpriceofseat = new javax.swing.JTextField();
        jcbtypeofseat = new javax.swing.JComboBox();
        jlbtypeofseat = new javax.swing.JLabel();
        jlbstateofseat = new javax.swing.JLabel();
        jcbstateofseat = new javax.swing.JComboBox();
        jbtncancel = new javax.swing.JButton();
        jbtndeleteseat = new javax.swing.JButton();
        jbtnupdateseat = new javax.swing.JButton();
        jbtnaddseat = new javax.swing.JButton();
        jbtnreset = new javax.swing.JButton();
        jtxtseatid = new javax.swing.JTextField();
        jlbseatid = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jlblistofseat = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtblistofseat = new javax.swing.JTable();

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jlbselectroom.setFont(new java.awt.Font("Tahoma", 3, 12)); // NOI18N
        jlbselectroom.setText("Select Room");

        jcbselectroom.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(120, 120, 120)
                .addComponent(jlbselectroom, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(40, 40, 40)
                .addComponent(jcbselectroom, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbselectroom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbselectroom))
                .addContainerGap(19, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jlbcodeid.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbcodeid.setText("Code ID");

        jcbroomname.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jlbroomname.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbroomname.setText("Room's Name");

        jlblocationofseat.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlblocationofseat.setText("Location of Seat");

        jlblocationofseatline.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlblocationofseatline.setText("Location of Seat Line");

        jlbpriceofseat.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbpriceofseat.setText("Price of Seat");

        jcbtypeofseat.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jlbtypeofseat.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbtypeofseat.setText("Type of Seat");

        jlbstateofseat.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbstateofseat.setText("State of Seat");

        jcbstateofseat.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jbtncancel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtncancel.setText("Cancel");

        jbtndeleteseat.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtndeleteseat.setText("Delete Seat");

        jbtnupdateseat.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtnupdateseat.setText("Update Seat");

        jbtnaddseat.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtnaddseat.setText("Add Seat");

        jbtnreset.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtnreset.setText("Reset");

        jlbseatid.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbseatid.setText("Seat ID");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(94, 94, 94)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(84, 84, 84)
                                .addComponent(jlbseatid)
                                .addGap(46, 46, 46)
                                .addComponent(jtxtseatid)
                                .addGap(26, 26, 26))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(9, 9, 9)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jlbcodeid)
                                    .addComponent(jlbroomname)
                                    .addComponent(jlblocationofseat)
                                    .addComponent(jlblocationofseatline)
                                    .addComponent(jlbstateofseat)
                                    .addComponent(jlbpriceofseat)
                                    .addComponent(jlbtypeofseat))
                                .addGap(46, 46, 46)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jtxtcodeid)
                                    .addComponent(jtxtlocationofseat)
                                    .addComponent(jtxtlocationofseatline)
                                    .addComponent(jtxtpriceofseat)
                                    .addComponent(jcbstateofseat, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jcbroomname, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jcbtypeofseat, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 301, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(0, 28, Short.MAX_VALUE)))
                        .addGap(107, 107, 107))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jbtnreset, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtnaddseat, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtnupdateseat)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtndeleteseat)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtncancel, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtseatid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbseatid))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtcodeid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbcodeid))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlbroomname)
                    .addComponent(jcbroomname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jlblocationofseat)
                    .addComponent(jtxtlocationofseat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(13, 13, 13)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtlocationofseatline, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlblocationofseatline))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtpriceofseat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbpriceofseat))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbtypeofseat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbtypeofseat))
                .addGap(15, 15, 15)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlbstateofseat)
                    .addComponent(jcbstateofseat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(24, 24, 24)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtncancel)
                    .addComponent(jbtndeleteseat)
                    .addComponent(jbtnupdateseat)
                    .addComponent(jbtnaddseat)
                    .addComponent(jbtnreset))
                .addContainerGap())
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jlblistofseat.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jlblistofseat.setText("List Of Seats");

        jtblistofseat.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "STT", "Code ID", "Location of Seat", "Location of Seat Line", "Type of Seat", "State of Seat"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane1.setViewportView(jtblistofseat);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jlblistofseat, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jScrollPane1)
                        .addContainerGap())))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jlblistofseat, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(268, 268, 268))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton jbtnaddseat;
    private javax.swing.JButton jbtncancel;
    private javax.swing.JButton jbtndeleteseat;
    private javax.swing.JButton jbtnreset;
    private javax.swing.JButton jbtnupdateseat;
    private javax.swing.JComboBox jcbroomname;
    private javax.swing.JComboBox jcbselectroom;
    private javax.swing.JComboBox jcbstateofseat;
    private javax.swing.JComboBox jcbtypeofseat;
    private javax.swing.JLabel jlbcodeid;
    private javax.swing.JLabel jlblistofseat;
    private javax.swing.JLabel jlblocationofseat;
    private javax.swing.JLabel jlblocationofseatline;
    private javax.swing.JLabel jlbpriceofseat;
    private javax.swing.JLabel jlbroomname;
    private javax.swing.JLabel jlbseatid;
    private javax.swing.JLabel jlbselectroom;
    private javax.swing.JLabel jlbstateofseat;
    private javax.swing.JLabel jlbtypeofseat;
    private javax.swing.JTable jtblistofseat;
    private javax.swing.JTextField jtxtcodeid;
    private javax.swing.JTextField jtxtlocationofseat;
    private javax.swing.JTextField jtxtlocationofseatline;
    private javax.swing.JTextField jtxtpriceofseat;
    private javax.swing.JTextField jtxtseatid;
    // End of variables declaration//GEN-END:variables
}
